package com.gasolinator.a.app.adapter;

import android.content.Context;
import android.location.Address;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gasolinator.a.R;

import java.util.List;

public class GasolinatorLookUpAdapter extends BaseAdapter
{
  List<Address> addresses;
  private Context mContext;

  public GasolinatorLookUpAdapter(Context paramContext)
  {
    this.mContext = paramContext;
  }

  public int getCount()
  {
    if (this.addresses == null);
    for (int i = 0; ; i = this.addresses.size())
      return i;
  }

  public Object getItem(int paramInt)
  {
    return Integer.valueOf(paramInt);
  }

  public long getItemId(int paramInt)
  {
    return paramInt;
  }

  public Address getObject(int paramInt)
  {
    return (Address)this.addresses.get(paramInt);
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    LinearLayout localLinearLayout = (LinearLayout)LayoutInflater.from(this.mContext).inflate(R.layout.search_address_adapter, paramViewGroup, false);
    Address localAddress = (Address)this.addresses.get(paramInt);
    TextView localTextView1 = (TextView)localLinearLayout.findViewById(R.id.Address1);
    String str1 = localAddress.getAddressLine(0);
    localTextView1.setText(str1);
    TextView localTextView2 = (TextView)localLinearLayout.findViewById(R.id.Address2);
    String str2 = localAddress.getAddressLine(1);
    localTextView2.setText(str2);
    return localLinearLayout;
  }

  public void setAddresses(List<Address> paramList)
  {
    this.addresses = paramList;
  }
}